home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1990 / Aug 90 / MacApp.Tech$ 8⁄10⁄90 / 1710-Re Dashed Lines-Aug90 < prev    next >
Encoding:
Text File  |  1991-03-06  |  2.2 KB  |  81 lines  |  [TEXT/GEOL]

  1. Item    9954747                         7-Aug-90        17:34PDT
  2.  
  3. From:   AFTERHOURS                      After Hours SW,Richard Wolpert,PRT
  4.  
  5. To:     PHAROS.TECH                     Pharos Tech, Tech Staff,PRT
  6.  
  7. cc:     MACAPP.TECH$                    MacApp Technical
  8.  
  9. Sub:    RE> Dashed Lines
  10.  
  11.  
  12.     TO: PHAROS.TECH,MACAPP.TECH$
  13.     FR: AFTERHOURS
  14.     RE: Dashed Lines in Postscript
  15.  
  16. Look at tech. Notes #72 and #91.  Each discusses LaserWriter specific
  17. information.  #91 discusses PicComments, one of which draws Dashed lines.  In
  18. MacApp, create a subclass of TView, something like TDashedLine, or embed the
  19. code in any other TView object in the .Draw method.  Quoting liberally from
  20. tech. Note #91, an view object class with dashed lines might look like this:
  21.  
  22.  
  23.     TDashedLine = OBJECT(TView)
  24.  
  25.         PROCEDURE TDashedLine.Draw(area: Rect); OVERRIDE;
  26.  
  27.         END;
  28.  
  29.  
  30.     PROCEDURE TDashedLine.Draw(area: Rect);
  31.     CONST
  32.         DashedLine = 180;
  33.         DashedStop = 181;
  34.         SetLineWidth = 182;
  35.     TYPE
  36.         DashedHdl = ^DashedPtr;
  37.         DashedPtr = ^TDashedLine;
  38.         TDashedLine = RECORD
  39.             offset  :   SignedByte;
  40.             Centered:   SignedByte;
  41.             Dashed  :    Array[0..1] OF SignedByte;
  42.         END;
  43.  
  44.         widHdl = ^widPtr;
  45.         widPtr = &widpt;
  46.         widpt = Point;
  47.     VAR
  48.         aRect       :   Rect;
  49.         width       :   WidHdl;
  50.         dashedln    :   DashedHdl;
  51.     BEGIN
  52.         dashedln := dashedHdl(NewHandle(SIZEOF(TDashedLine)));
  53.         dashedln^^.offset := 0;
  54.         dashedln^^.centered := 0;
  55.         dashedln^^.dashed[0] := 1;      { length }
  56.         dashedln^^.dashed[1] := 8;      { 8 points on, 8 points off }
  57.  
  58.         width := widhdl(NewHandle(SIZEOF(widpt)));
  59.         width^^.h := 2;
  60.         width^^.v := 7;
  61.  
  62.         PicComment(DashedLine, GetHandleSize(dashedln), Handle(dashedln));
  63.         PicComment(SetLineWidth, 4, Handle(width));
  64.  
  65.         { draw your line, shape, etc here }
  66.         MoveTo(100, 100);
  67.         LineTo(500, 500);
  68.  
  69.         PicComment(DashedStop, 0, NIL);
  70.  
  71.         INHERITED Draw(area);
  72.     END;
  73.  
  74.  
  75. I've done a similar thing with embedded spostscript code for other purposes, so
  76. something like this should work.  Good luck...
  77.  
  78. Dan Cooley
  79. After Hours Software
  80.  
  81.